﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using BLL;
using Model;

namespace AcceptServer
{
    public class OperateDataBase
    {

       
        readonly BTaxiGpsHistory _bTaxiGpsHistory = new BTaxiGpsHistory();
        
        private readonly BPhoneUser _bPhoneUser = new BPhoneUser();
        private readonly BTaxi _bTaxi = new BTaxi();
        private readonly BDriver _bDriver = new BDriver();
        private readonly BOrder _bOrder = new BOrder();

        public TaxiInfo TaxiGetModelByPhoneNum(string phoneNumber)
        {
            return _bTaxi.GetModelByPhoneNum(phoneNumber);
        }

        public bool TaxiExistsPhoneNum(string phoneNumber)
        {
            return _bTaxi.ExistsPhoneNum(phoneNumber);
        }

        public bool DriverCardChangePassword(string cardId, string oldPwd, string newPwd)
        {
            return _bDriver.ChangePassword(cardId, oldPwd, newPwd);
        }

        public DriverInfo DriverGetModelByPhoneNum(string phoneNumber)
        {
            return _bDriver.GetModelByPhoneNum(phoneNumber);
        }

        public void AddTaxiGpsHistoryInfo(TaxiGpsHistoryInfo taxiGpsHistoryInfo)
        {
            _bTaxiGpsHistory.Add(taxiGpsHistoryInfo);
        }
          
        public bool PhoneUserExists(string phoneNumber)
        {
            return _bPhoneUser.Exists(phoneNumber);
        }

        public bool PhoneUserAdd(PhoneUserInfo model)
        {
            return _bPhoneUser.Add(model);
        }

        public Model.PhoneUserInfo PhoneUserGetModelByNumber(string phone)
        {
            return _bPhoneUser.GetModelByNumber(phone);
        }

        public bool PhoneUserUpdateWhenLogin(Model.PhoneUserInfo model)
        {
            return _bPhoneUser.UpdateWhenLogin(model);
        }
        public bool PhoneUserClearImei(string phoneNumber)
        {
            return _bPhoneUser.ClearImei(phoneNumber);
        }

        public int AddListTaxiGpsHistory(string sql)
        {
            return _bTaxiGpsHistory.AddList(sql);
        }

        public bool TaxiUpdateImei(string phoneNumber, string imei)
        {
            return _bTaxi.UpdateImei(phoneNumber, imei);
        }

        public DriverInfo DriverCheckCard(string cardId, string password)
        {
            return _bDriver.CheckCard(cardId, password);
        }



       
        public int OrderAdd(OrderInfo model)
        {
            return _bOrder.Add(model);
        }
         
        public DataSet OrderGetList(string strWhere)
        {
            return _bOrder.GetList(strWhere);
        }

        public bool OrderUpdateOneColumns(int orderId,string para, string paraValue)
        {
            return _bOrder.UpdateOneColumns(orderId,para, paraValue);
        }

        public bool OrderUpdateWhenPsgAcceptOrder(string phoneNumber,
               string phoneOrderId, string time)
        {
            return _bOrder.UpdateWhenPsgAcceptOrder(phoneNumber, phoneOrderId, time);
        }

        public bool OrderCancleOrder(string phoneNumber,
                             string phoneOrderId)
        {
            return _bOrder.CancleOrder(phoneNumber, phoneOrderId);
        }

         public bool OrderUpdateWhenPlatformSubmit(OrderInfo order)
         {
             return _bOrder.UpdateWhenPlatformSubmit(order);
         }

        public bool OrderUpdateWhenDriverAccept(int orderId, string time)
        {
            return _bOrder.UpdateWhenDriverAcceptOrder(orderId, time);
        }

        public bool OrderExistsOrderId(string phoneNumber, string orderId)
        {
            return _bOrder.ExistsOrderId(phoneNumber, orderId);
        }

        public bool OrderUpdateWhenPaid(string phoneNumber,
         string phoneOrderId, int payType, string payOrderId)
        {
            return _bOrder.UpdateWhenPaidAnOrder(phoneNumber, phoneOrderId,
                payType, payOrderId);
        }


        public Model.PhoneUserInfo GetModelByNumber(string phoneNumber)
        {
            return _bPhoneUser.GetModelByNumber(phoneNumber);
        }

        public bool PhoneUserUpdateInfoByUser(string strPhone, string strName)
        {
            return _bPhoneUser.UpdateInfoByUser(strPhone, strName);
        }
    }
}
